<?php

hc_core_ClassLoader::load('halo_HttpRequest');
hc_core_ClassLoader::load('halo_HttpResponse');

hc_core_ClassLoader::load('substrate_Context');

class halo_DispatcherUtil {

    protected static $CONTEXT_KEY = '__halo_context';

    public static function MAKE_HTTP_REQUEST() {
        $httpRequest = new halo_HttpRequest(
            $_SERVER['REQUEST_METHOD'],
            $_GET,
            $_POST,
            $_FILES,
            $_SERVER
        );
        return $httpRequest;
    }

    public static function MAKE_HTTP_RESPONSE() {
        $httpResponse = new halo_HttpResponse();
        return $httpResponse;
    }

    public static function GET_CONTEXT(halo_HttpRequest $httpRequest) {
        return $httpRequest->getAttribute(self::$CONTEXT_KEY);
    }

    public static function SET_CONTEXT(halo_HttpRequest $httpRequest, substrate_Context $context) {
        return $httpRequest->setAttribute(self::$CONTEXT_KEY, $context);
    }

}

?>
